package edu.gatech.ealf;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import edu.gatech.ealf.magiclenseplaf.MagicLenseLookAndFeel;

public class Demo extends JFrame {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Demo d = new Demo();
    }
    
    LookAndFeel aux = MagicLenseLookAndFeel.getInstance();
    boolean auxOn = true;
    JPanel centerPanel;
    public Demo(){
        
        UIManager.addAuxiliaryLookAndFeel(aux);
        centerPanel = new JPanel();
        centerPanel.setLayout(new FlowLayout());
        JButton b = new JButton("foo");
        setLayout(new BorderLayout());
        b.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                /*
                JFrame f = new JFrame();
                f.add(EasyAccessibilityLookAndFeel.getConfigurationPanel());
                f.pack();
                f.setVisible(true);
                */
                if(auxOn){
                    System.out.println(UIManager.getLookAndFeel());
                    System.out.println(UIManager.removeAuxiliaryLookAndFeel(aux));
                    System.out.println(UIManager.getLookAndFeel());
                    try {
                        UIManager.setLookAndFeel(UIManager.getLookAndFeel());
                    } catch (UnsupportedLookAndFeelException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                    centerPanel.add(new JButton("barf"));
                } else {
                    UIManager.addAuxiliaryLookAndFeel(aux);
                }
            }
            
        });

        centerPanel.add(b);
        add(new JLabel("Bar"), BorderLayout.NORTH);
        add(centerPanel, BorderLayout.CENTER);
        add(new JLabel("Bar"), BorderLayout.SOUTH);
        add(new JLabel("Bar"), BorderLayout.EAST);
        add(new JLabel("Bar"), BorderLayout.WEST);
        pack();
        setVisible(true);
    }

}
